home *** CD-ROM | disk | FTP | other *** search
/ El Mac 1 / Magazine.iso / EL MAC 1 / Shareware / Utilities / MrPrefman 1.0b1 / Login as Quinn next >
Encoding:
Text File  |  1995-09-07  |  2.0 KB  |  54 lines  |  [TEXT/ToyS]

  1. -- This script is distributed as a text script instead of a compiled script because AppleScript
  2. -- has a habit of not being able to edit scripts that were compiled with older versions of
  3. -- AppleScript. To use this script in practice, change the "Quinn" in the line marked with
  4. -- a ••• to your Mr Prefman user name and then use the Script Editor’s Save as command
  5. -- to create an application out of the script.
  6.  
  7. on quitIt(procname, procsig)
  8.     -- quit the process with the given name and signature
  9.     if procsig = «class ToyS» then
  10.         -- don't quit the Script Editor, 'cause it makes development kinda hard
  11.     else if procsig = «class aplt» then
  12.         -- don't quit ourselves
  13.     else
  14.         -- some programs (such as Think Pascal and Eudora) have
  15.         -- problems if you send them the saving parameter
  16.         tell application procname to activate
  17.         tell application procname to quit
  18.     end if
  19. end quitIt
  20.  
  21. on run
  22.     -- do all sorts of logout-type things with the Finder
  23.     tell application "Finder"
  24.         -- close all windows
  25.         close every window
  26.         -- quit all processes
  27.         -- be careful here, we must sample the process list before
  28.         -- we start quitting processes otherwise the indexes get very confused
  29.         -- get these things "as list" otherwise a single item
  30.         -- comes back not in a list, which confuses the repeat loop
  31.         set names to name of every process as list
  32.         set types to creator type of every process as list
  33.         -- now start quitting process
  34.         repeat with i from 1 to length of names
  35.             tell me to quitIt(item i of names, item i of types)
  36.         end repeat
  37.         -- now junk the server volumes, using a similar technique
  38.         activate
  39.         set names to name of every disk as list
  40.         set locals to local volume of every disk as list
  41.         repeat with i from (length of names) to 1 by -1
  42.             if not item i of locals then
  43.                 put away disk (item i of names)
  44.             end if
  45.         end repeat
  46.     end tell
  47.     -- now tell Mr Prefman to establish Quinn's preference files
  48.     tell application "Mr Prefman"
  49.         activate
  50.         switch to user "Quinn" -- •••
  51.         quit
  52.     end tell
  53. end run
  54.